package com.ssy.lingxi.purchase.entity.tender;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonManagedReference;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.io.Serializable;
import java.util.List;

/**
 * 评标专家抽取记录
 * @author jw.chen
 * @version 2.0.0
 * @date 2021/3/1
 */
@Getter
@Setter
@Entity
@Table(schema = "public", name = "purchase_evaluation_tender_expert_extract_record")
public class ExpertExtractRecord implements Serializable {
    private static final long serialVersionUID = 5919300608465617501L;
    /**
     * 主键id
     */
    @Id
    @GeneratedValue(strategy= GenerationType.SEQUENCE, generator="evaluation_tender_expert_extract_record_seq")
    @SequenceGenerator(sequenceName="purchase_evaluation_tender_expert_extract_record_seq", name="evaluation_tender_expert_extract_record_seq",allocationSize = 1)
    private Long id;

    /**
     * 评标专家抽取
     */
    @JsonIgnore
    @ManyToOne(cascade = {CascadeType.PERSIST})
    @JoinColumn(name="expertExtractId",referencedColumnName = "id")
    private ExpertExtract expertExtract;

    /**
     * 评标专家
     */
    @OneToOne(cascade = {CascadeType.PERSIST})
    @JoinColumn(name="expertId",referencedColumnName = "id")
    private Expert expert;

    /**
     * 评标信息
     */
    @JsonManagedReference
    @OneToMany(mappedBy = "expertExtractRecord", cascade={CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE})
    private List<EvaluationTenderOnline> evaluationTenderList;

    /**
     * 状态: 1-待发送; 2-待确认; 3-已确认; 4-已拒绝; 5-已评标;
     */
    @Column(columnDefinition = "int", nullable = false)
    private Integer status = 1;

    /**
     * 来源：1-系统抽取; 2-人工抽取;
     */
    @Column(columnDefinition = "int", nullable = false)
    private Integer source;

    /**
     * 原因
     */
    @Column(columnDefinition = "varchar(200)")
    private String remark;

    /**
     * 创建时间
     */
    @Column(columnDefinition = "int8")
    private Long createTime = System.currentTimeMillis();

}
